package com.becca.cake.service.orders;

import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.dao.DataAccessException;

import com.becca.cake.core.exception.ServiceException;
import com.becca.cake.model.logistic.LogisticStatusModel;
import com.becca.cake.model.order.GoodOrderModel;
import com.becca.cake.model.order.OrderDetailsModel;
import com.becca.cake.model.order.OrderExcelModel;
import com.becca.cake.model.order.OrderModel;
import com.becca.cake.model.order.OrderRefundsModel;
import com.becca.cake.model.order.OrdersTodayModel;

/**
 * 
 * 订单管理service接口
 * @copyright  尊星(上海)信息科技有限公司
 * @author yellow
 * @date 2016年5月18日 下午3:30:46
 */
public interface IOrderService {
    /**
     * 初始化百度数据
     */
    void initBaiduRangeInfo();

    /**
     * 查询订单数据
     * @param map
     * @return
     * @throws Exception
     */
    List<OrderModel> selectOrders(Map<String, Object> map) throws ServiceException;

    /**
     * 查询订单总记录数
     * @param map
     * @return
     * @throws Exception
     */
    Long selectOrdersCount(Map<String, Object> map) throws ServiceException;

    /**
     * 修改订单信息
     * @author yellow
     * @param orderModel
     * @throws Exception
     */
    void updateOrder(OrderModel orderModel) throws Exception;

    /**
     * 根据orderId查询订单对象，返回OrderModel
     * @param orderId
     * @return
     * @throws Exception
     */
    OrderModel findOrderById(Integer orderId) throws Exception;

    /**
     * 根据订单号查询订单详情
     * @param orderId
     * @return
     * @throws Exception
     */
    List<OrderDetailsModel> selectDetailsByOrderId(Integer orderId) throws Exception;

    /**
     * 修改订单状态
     * @param paramMap
     */
    void updateOrderStatus(Map<String, Object> paramMap) throws ServiceException;

    /**
     * 修改物流单号
     * @param paramMap
     */
    void updateOrderLogisticNo(Map<String, Object> paramMap) throws ServiceException;

    /**
     * 查询物流状态
     * @param map
     * @return
     * @throws DataAccessException
     */
    List<LogisticStatusModel> queryLogisticStatus(Map<String, Object> map) throws ServiceException;

    /**
     * 查询物流状态总数
     * @param map
     * @return
     * @throws DataAccessException
     */
    Long queryLogisticStatusCount(Map<String, Object> map) throws ServiceException;

    /**
     * 热敏订单生成静态页面
     * @param map
     * @throws ServiceException
     */
    List<String> printThermalOrder(String htmlFilePath, Map<String, Object> map) throws Exception;

    /**
     * 交接单打印：查询交接订单列表
     * @param orderIds
     * @return
     * @throws ServiceException
     */
    List<OrderModel> selectHandOverOrders(String orderIds) throws ServiceException;

    /**
     * 试吃交接单打印：查询交接订单列表
     * @param orderIds
     * @return
     * @throws ServiceException
     */
    List<OrderModel> selectHandOverOrdersComfirmed(String orderIds) throws ServiceException;

    /**
     * 交接单打印：查询交接详情列表
     * @return
     * @throws ServiceException
     */
    List<OrderDetailsModel> selectHandOverOrderDetails(Integer orderId) throws ServiceException;

    /**
     * 批量导出
     * @param list
     * @throws ServiceException
     */
    void exportOrdersToExcel(HttpServletRequest request, HttpServletResponse response,
                             List<OrderDetailsModel> list) throws ServiceException;

    /**
     * 订单详情 ：导出excel
     * 
     * @param orderId
     * @return
     * @throws DataAccessException
     */
    List<OrderExcelModel> selectOrderExcelModel(String orderIds) throws ServiceException;

    /**
     * 填写配送人员信息
     * @param map
     * @throws ServiceException
     */
    void updateOrderDeliveryInfo(Map<String, Object> map) throws ServiceException;

    /**
     * 修改物流信息
     * @param map
     * @throws ServiceException
     */
    void updateOrderLogisticsMessage(Map<String, Object> map) throws ServiceException;

    /**
     * 拒收订单
     * @param map
     * @throws ServiceException
     */
    void updRefuseReceiveOrder(Map<String, Object> map) throws ServiceException;

    /**
     * 每天的订单明细
     * @param preDayTime
     * @param nowDayTime
     * @return
     * @throws ServiceException
     */
    Map<String, Object> selectDayOrders() throws Exception;

    /**
     * 每天报表统计
     * @return
     * @throws Exception
     */
    Map<String, Object> statisticsOrderReport() throws Exception;

    //    /**
    //     * 生成订单信息
    //     * @param jsonMessage
    //     * @param usersModel
    //     * @return
    //     */
    //    void saveOrder(GoodOrderModel goodOrderModel,String jsonList,String userName) throws Exception;
    //    
    /**
     * 查询商品尺寸
     * @param orderId
     * @return
     * @throws Exception
     */
    List<GoodOrderModel> selectGoodsPrize(Map<String, Object> map) throws Exception;

    Long selectGoodsPrizeCount(Map<String, Object> map) throws Exception;

    /**
     * 生成订单信息
     * @param jsonList
     * @param goodOrderModel
     * @return
     */
    void saveOrder(GoodOrderModel goodOrderModel, String jsonList, String userName)
                                                                                   throws Exception;

    /**
     * 查询全部退款数据
     * @param paramerMap
     * @return
     */
    List<OrderRefundsModel> selectOrderRefundsList(Map<String, Object> paramerMap) throws Exception;

    /**
     * 查询全部退款总数
     * @param paramerMap
     * @return
     */
    Long selectOrderRefundsCount(Map<String, Object> paramerMap) throws Exception;

    /**
     * 修改订单退款状态
     * @param orderRefundsModel
     * @return
     */
    void updateOrderRefundsStatus(OrderRefundsModel orderRefundsModel) throws Exception;

    /**
     * 修改订单退款状态
     * @param paramMap
     */
    void updateOrderRefundsStatus(Map<String, Object> paramMap) throws ServiceException;

    /**
     * 今日达订单数据
     * @param map
     * @return
     * @throws Exception
     */
    List<OrdersTodayModel> selectTodayOrders(Map<String, Object> map) throws ServiceException;

    /**
     * 今日达订单总记录数
     * @param map
     * @return
     * @throws Exception
     */
    Long selectTodayOrdersCount(Map<String, Object> map) throws ServiceException;
}
